<!-- 群列表 -->
<template>
  <div class="group-box">
    <div
      v-for="item in groupList"
      :key="item.id"
      class="group-item"
      @click="$emit('selectedChange', item)"
      :class="{ active: currentChat === item.id }"
    >
      <chatAvatar :content="item.avatarList"></chatAvatar>
      <span class="group-name">{{ item.name }}</span>
    </div>
  </div>
</template>

<script>
import { mapState } from "vuex"
import chatAvatar from "../common/avatar.vue"
export default {
  name: "groupPage",
  data() {
    return {
      currentChat: "32233725882000188",
      userList: []
    }
  },
  components: { chatAvatar },
  computed: {
    ...mapState({
      groupList: (state) => state.groupList
    })
  },
  created() {},
  methods: {}
}
</script>
<style lang="less" scoped>
.group-item {
  display: flex;
  align-items: center;
  padding: 16px 0;
  padding-left: 12px;
  cursor: pointer;
  &:hover,
  &.active {
    background: #edf0f6;
  }
  .group-name {
    padding-left: 10px;
    font-size: 14px;
    color: #333333;
    font-weight: 600;
  }
}
</style>
